cat >/usr/lib/systemd/system/prometheus.service<<EOF
[Unit]
Description=Prometheus Server 
Documentation=https://prometheus.io/docs/introduction/overview/ 
After=network.target
[Service] 
User=root 
Group=root 
Type=simple 
Restart=on-failure 
WorkingDirectory=/opt/software/prometheus-2.46.0
ExecStart=/opt/software/prometheus-2.46.0/prometheus --web.listen-address=:9090 --storage.tsdb.retention=30d --web.enable-lifecycle --config.file=/opt/software/prometheus-2.46.0/prometheus.yml --storage.tsdb.path=/data/prometheusData
ExecReload=/bin/kill -HUP $MAINPID 
RuntimeDirectory=prometheus 
RuntimeDirectoryMode=0750 
LimitNOFILE=10000 
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl start prometheus
systemctl enable prometheus